#include "GameApplication.h"

#include "Scenes.h"

GameApplication::GameApplication()
{
	Construct( gdn::Vector2i( 320, 240 ), 32, "Elusion - Mysterious Manifestion of the Mumbling Moocows" );
}

GameApplication::~GameApplication()
{
	Destruct();
}

int GameApplication::Run()
{
	return gdn::Application::Run();
}

void GameApplication::Close()
{
	gdn::Application::Close();
}

void GameApplication::AddScene( const std::string& name, gdn::Scene* scene )
{
	gdn::Application::AddScene( name, scene );
}

void GameApplication::RemoveScene( const std::string& name )
{
	gdn::Application::RemoveScene( name );
}

bool GameApplication::DoesSceneExist( const std::string& name ) const
{
	return gdn::Application::DoesSceneExist( name );
}

std::vector< std::string > GameApplication::GetSceneList() const
{
	return gdn::Application::GetSceneList();
}

gdn::Scene* GameApplication::FindScene( const std::string& name ) const
{
	return gdn::Application::FindScene( name );
}

void GameApplication::SetActiveScene( const std::string& name )
{
	gdn::Application::SetActiveScene( name );
}

const std::string& GameApplication::GetActiveSceneName() const
{
	return gdn::Application::GetActiveSceneName();
}

void GameApplication::Construct( const gdn::Vector2i& windowSize, unsigned int windowBpp, const std::string& windowTitle )
{
	gdn::Application::Construct( windowSize, windowBpp, windowTitle );

	AddScene( "Loading", new SceneLoading( *this ) );
	AddScene( "Splash", new SceneSplash( *this ) );
	AddScene( "Main Menu", new SceneMainMenu( *this ) );
	AddScene( "New File", new SceneNewFile( *this ) );
	AddScene( "Game", new SceneGame( *this ) );

	SetActiveScene( "Loading" );

	GameConfig.LoadFromFile();
}

void GameApplication::Destruct()
{
	gdn::Application::Destruct();
}
